<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 2006-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>acc_present_or_copyin (GNU libgomp)</title>

<meta name="description" content="acc_present_or_copyin (GNU libgomp)">
<meta name="keywords" content="acc_present_or_copyin (GNU libgomp)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Library-Index.html" rel="index" title="Library Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="OpenACC-Runtime-Library-Routines.html" rel="up" title="OpenACC Runtime Library Routines">
<link href="acc_005fcreate.html" rel="next" title="acc_create">
<link href="acc_005fcopyin.html" rel="prev" title="acc_copyin">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="section-level-extent" id="acc_005fpresent_005for_005fcopyin">
<div class="nav-panel">
<p>
Next: <a href="acc_005fcreate.html" accesskey="n" rel="next"><code class="code">acc_create</code> &ndash; Allocate device memory and map it to host memory.</a>, Previous: <a href="acc_005fcopyin.html" accesskey="p" rel="prev"><code class="code">acc_copyin</code> &ndash; Allocate device memory and copy host memory to it.</a>, Up: <a href="OpenACC-Runtime-Library-Routines.html" accesskey="u" rel="up">OpenACC Runtime Library Routines</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="acc_005fpresent_005for_005fcopyin-_002d_002d-If-the-data-is-not-present-on-the-device_002c-allocate-device-memory-and-copy-from-host-memory_002e"><span>6.19 <code class="code">acc_present_or_copyin</code> &ndash; If the data is not present on the device, allocate device memory and copy from host memory.<a class="copiable-link" href="#acc_005fpresent_005for_005fcopyin-_002d_002d-If-the-data-is-not-present-on-the-device_002c-allocate-device-memory-and-copy-from-host-memory_002e"> &para;</a></span></h3>
<dl class="table">
<dt><em class="emph">Description</em></dt>
<dd><p>This function tests if the host data specified by <var class="var">a</var> and of length
<var class="var">len</var> is present or not. If it is not present, then device memory
will be allocated and the host memory copied. The device address of
the newly allocated device memory is returned.
</p>
<p>In Fortran, two (2) forms are supported. In the first form, <var class="var">a</var> specifies
a contiguous array section. The second form <var class="var">a</var> specifies a variable or
array element and <var class="var">len</var> specifies the length in bytes.
</p>
<p>Note that <code class="code">acc_present_or_copyin</code> and <code class="code">acc_pcopyin</code> exist for
backward compatibility with OpenACC 2.0; use <a class="ref" href="acc_005fcopyin.html"><code class="code">acc_copyin</code> &ndash; Allocate device memory and copy host memory to it.</a> instead.
</p>
</dd>
<dt><em class="emph">C/C++</em>:</dt>
<dd><table class="multitable">
<tbody><tr><td width="20%"><em class="emph">Prototype</em>:</td><td width="80%"><code class="code">void *acc_present_or_copyin(h_void *a, size_t len);</code></td></tr>
<tr><td width="20%"><em class="emph">Prototype</em>:</td><td width="80%"><code class="code">void *acc_pcopyin(h_void *a, size_t len);</code></td></tr>
</tbody>
</table>

</dd>
<dt><em class="emph">Fortran</em>:</dt>
<dd><table class="multitable">
<tbody><tr><td width="20%"><em class="emph">Interface</em>:</td><td width="80%"><code class="code">subroutine acc_present_or_copyin(a)</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">type, dimension(:[,:]...) :: a</code></td></tr>
<tr><td width="20%"><em class="emph">Interface</em>:</td><td width="80%"><code class="code">subroutine acc_present_or_copyin(a, len)</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">type, dimension(:[,:]...) :: a</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">integer len</code></td></tr>
<tr><td width="20%"><em class="emph">Interface</em>:</td><td width="80%"><code class="code">subroutine acc_pcopyin(a)</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">type, dimension(:[,:]...) :: a</code></td></tr>
<tr><td width="20%"><em class="emph">Interface</em>:</td><td width="80%"><code class="code">subroutine acc_pcopyin(a, len)</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">type, dimension(:[,:]...) :: a</code></td></tr>
<tr><td width="20%"></td><td width="80%"><code class="code">integer len</code></td></tr>
</tbody>
</table>

</dd>
<dt><em class="emph">Reference</em>:</dt>
<dd><p><a class="uref" href="https://www.openacc.org">OpenACC specification v2.6</a>, section
3.2.20.
</p></dd>
</dl>



</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="acc_005fcreate.html"><code class="code">acc_create</code> &ndash; Allocate device memory and map it to host memory.</a>, Previous: <a href="acc_005fcopyin.html"><code class="code">acc_copyin</code> &ndash; Allocate device memory and copy host memory to it.</a>, Up: <a href="OpenACC-Runtime-Library-Routines.html">OpenACC Runtime Library Routines</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
